package com.wjl.guli.service.edu.controller;

import com.wjl.guli.common.base.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

@Api(tags ="test login")
@RestController
@RequestMapping("/user")
@CrossOrigin
public class LoginController {
    @ApiOperation("login")
    @PostMapping("login")
    public R login(String username,String password){
        return R.ok().data("token","admin");
    }
    @ApiOperation("getInfo")
    @GetMapping("info")
    public R info(String token){
        return R.ok().data("roles", Arrays.asList("admin")).data("name","user").data("avatar","https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2856846879,389279115&fm=26&gp=0.jpg");
    }
    @ApiOperation("logout")
    @PostMapping("logout")
    public R logout(){
        return R.ok();
    }
}
